﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
					xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
					xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
					xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:ViewModel="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ViewModel"
					xmlns:Controls="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Controls"
                    xmlns:Converters="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Converters"
					mc:Ignorable="d" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase" xmlns:BlockSpecifics="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ViewModel.BlockSpecifics" xmlns:System="clr-namespace:System;assembly=mscorlib">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime;component/Resources/Converters.xaml" />
        <ResourceDictionary Source="/Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime;component/Resources/Brushes.xaml" />
        <ResourceDictionary Source="/Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime;component/Resources/ExpanderDictionary.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <System:Double x:Key="SharedColumnMinWidth">100</System:Double>
    <GridLength x:Key="SharedColumnWidth">250</GridLength>

    <Style x:Key="ContextAdderButtonMenuStyle" TargetType="{x:Type Controls:ContextMenuButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <ContentControl Focusable="False" x:Name="AddButtonVisual" Foreground="{DynamicResource ElementCommandNormalBrush}" Background="{DynamicResource ElementCommandBackgroundBrush}" >
                        <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="17" Height="17">
                            <Path Width="18" Height="18" Canvas.Left="-0.499999" Canvas.Top="-0.499999" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00949494" Fill="{Binding Background, ElementName=AddButtonVisual}" Data="F1 M 3,9.53674e-007L 14,9.53674e-007C 15.6569,9.53674e-007 17,1.34315 17,3L 17,14C 17,15.6569 15.6569,17 14,17L 3,17C 1.34315,17 5.23122e-007,15.6569 5.23122e-007,14L 5.23122e-007,3C 5.23122e-007,1.34315 1.34315,9.53674e-007 3,9.53674e-007 Z "/>
                            <Path Width="18" Height="18" Canvas.Left="-0.499999" Canvas.Top="-0.499999" Stretch="Fill" StrokeLineJoin="Round" Stroke="{DynamicResource ElementCommandNormalBrush}" Data="F1 M 3,9.53674e-007L 14,9.53674e-007C 15.6569,9.53674e-007 17,1.34315 17,3L 17,14C 17,15.6569 15.6569,17 14,17L 3,17C 1.34315,17 5.23122e-007,15.6569 5.23122e-007,14L 5.23122e-007,3C 5.23122e-007,1.34315 1.34315,9.53674e-007 3,9.53674e-007 Z "/>

                            <Path Width="3" Height="11" Canvas.Left="7" Canvas.Top="3" Stretch="Fill" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource ElementCommandShadowBrush}" Data="F1 M 8.5,4.5L 8.5,12.5"/>
                            <Path Width="11" Height="3" Canvas.Left="3.00001" Canvas.Top="7.00001" Stretch="Fill" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource ElementCommandShadowBrush}" Data="F1 M 4.50001,8.50001L 12.5,8.50001L 4.50001,8.50001 Z "/>

                            <Path Width="2" Height="10" Canvas.Left="6.93334" Canvas.Top="3.03334" Stretch="Fill" StrokeThickness="2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{Binding Foreground, ElementName=AddButtonVisual}" Data="F1 M 7.93334,4.03334L 7.93334,12.0333"/>
                            <Path Width="10" Height="2" Canvas.Left="2.93334" Canvas.Top="7.03334" Stretch="Fill" StrokeThickness="2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{Binding Foreground, ElementName=AddButtonVisual}" Fill="#FFACACAC" Data="F1 M 3.93334,8.03334L 11.9333,8.03334L 3.93334,8.03334 Z "/>
                        </Canvas>
                    </ContentControl>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="AddButtonVisual" Property="Foreground" Value="{DynamicResource ElementCommandMouseOverBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ContextMenuStyle">
        <Style.Resources>
            <!-- This is here as setting MenuItem.AutomatinProperties.AutomationId does not work -->
            <Style TargetType="{x:Type Controls:SelectionNotifyingMenuItem}">
                <Setter Property="AutomationProperties.AutomationId" Value="{Binding Title}"  />
            </Style>

            <HierarchicalDataTemplate DataType="{x:Type ViewModel:CommandModel}" ItemsSource="{Binding ChildCommands}">
                <Label ToolTip="{Binding Title}" >
                    <Label.Content>
                        <AccessText Text="{Binding Title}" TextTrimming="CharacterEllipsis"  MaxWidth="450" />
                    </Label.Content>
                </Label>
            </HierarchicalDataTemplate>

        </Style.Resources>
    </Style>

    <Style x:Key="BindablePropertyStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="HorizontalAlignment" Value="Stretch"  />
        <Style.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="TextBlock.FontWeight" Value="Bold"/>
            </Trigger>
            <Trigger Property="Validation.HasError"
					 Value="true">
                <Setter Property="ToolTip"                        
                        Value="{Binding Path=(Validation.Errors), RelativeSource={RelativeSource Self}, Converter={StaticResource ErrorsToStringConverter}}" />
            </Trigger>
            <Trigger Property="Validation.HasError"
					 Value="false">
                <Setter Property="ToolTip" Value="{Binding BindableValue}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Controls:SelectionNotifyingContextMenu x:Key="SelectionNotifyingContextMenu" 
                                            ItemsSource="{Binding Commands}" 
                                            Style="{StaticResource ContextMenuStyle}" />

    <Style x:Key="ElementContainerWithContextMenu"  
           TargetType="{x:Type Controls:ElementModelContainer}" 
           BasedOn="{StaticResource {x:Type Controls:ElementModelContainer}}">
        <Setter Property="ContextMenu" Value="{StaticResource SelectionNotifyingContextMenu}" />
    </Style>


    <DataTemplate DataType="{x:Type ViewModel:ElementViewModel}">
        <Controls:ElementModelContainer DataContext="{Binding}" Style="{StaticResource ElementContainerWithContextMenu}" />
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:ElementListLayout}">
        <ItemsControl Focusable="False"  ItemsSource="{Binding Elements}" >
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Focusable="False">
                        <ContentControl Focusable="False" Content="{Binding Bindable}" />
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:ListLayout}">
        <ItemsControl ItemsSource="{Binding Elements}"  Focusable="False">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Focusable="False">
                        <ContentControl Focusable="False" Content="{Binding Bindable}" />
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:HorizontalListLayout}">
        <Grid x:Name="Grid" 
                VerticalAlignment="Stretch" 
                Focusable="False"
                Visibility="{Binding CanResize, Converter={StaticResource BooleanToVisibilityConverter}}"
                Controls:GridSplitterKeyAccelerator.TargetColumn="0"
                Controls:GridSplitterKeyAccelerator.DecrementKeyGesture="Alt+Ctrl+Left"
                Controls:GridSplitterKeyAccelerator.IncrementKeyGesture="Alt+Ctrl+Right">
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="{StaticResource SharedColumnMinWidth}" Width="{StaticResource SharedColumnWidth}" SharedSizeGroup="{Binding ColumnName}" />
                <ColumnDefinition Width="Auto" SharedSizeGroup="SplitterSizeGroup"  />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ContentControl x:Name="Content"
                            VerticalAlignment="Stretch" 
                            Grid.Column="0" 
                            Content="{Binding Current}" 
                            Focusable="False" 
                            HorizontalAlignment="Stretch"/>

            <GridSplitter   Focusable="False"
                            x:Name="Splitter"
                            Grid.Column="1" 
                            Grid.Row="0"
                            Grid.RowSpan="2"
                            BorderBrush="Black" 
                            BorderThickness="1"
                            Opacity="0.15"
                            Width="3"
                            Background="Transparent" 
                            ResizeDirection="Columns" 
                            ResizeBehavior="PreviousAndCurrent"
                            ShowsPreview="True"
                            Visibility="{Binding CanResize, Converter={StaticResource BooleanToVisibilityConverter}}"
                            />

            <ContentControl Focusable="False" VerticalAlignment="Stretch" Grid.RowSpan="2" Grid.Column="2" Content="{Binding}">
                <ContentControl.ContentTemplate>
                    <DataTemplate>
                        <ContentControl VerticalAlignment="Stretch"
                                        x:Name="Next" 
                                        Visibility="Collapsed"
                                        Focusable="False"/>

                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding HasNext}" Value="true">
                                <Setter TargetName="Next" Property="Content" Value="{Binding Next}" />
                                <Setter TargetName="Next" Property="Visibility" Value="{Binding CanResize, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ContentControl.ContentTemplate>
            </ContentControl>

            <StackPanel
                    Grid.Column="0"
                    Grid.ColumnSpan="3"
                    Grid.Row="1">
                <ContentControl Focusable="False" Content="{Binding Contained}" />
            </StackPanel>
        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding OwnsResizing}" Value="False">
                <Setter TargetName="Splitter" Property="Visibility" Value="Collapsed" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:TwoVerticalsLayout}">
        <StackPanel>
            <ContentControl Focusable="False"  Content="{Binding First}" />
            <ContentControl Focusable="False" Content="{Binding Second}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:TwoColumnsLayout}">
        <Grid Controls:GridSplitterKeyAccelerator.TargetColumn="0"
              Controls:GridSplitterKeyAccelerator.DecrementKeyGesture="Alt+Ctrl+Left"
              Controls:GridSplitterKeyAccelerator.IncrementKeyGesture="Alt+Ctrl+Right"
            >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" SharedSizeGroup="{Binding ColumnName}" />
                <ColumnDefinition Width="Auto" SharedSizeGroup="SplitterSizeGroup" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <ContentControl Focusable="False" Grid.Column="0" Content="{Binding Left}" />

            <ContentControl Focusable="False" Grid.Column="2" Content="{Binding Right}" />

        </Grid>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:HeaderLayout}">
        <Grid Focusable="False"
              ScrollViewer.VerticalScrollBarVisibility="Disabled" 
              Margin="12, 0, 12, 6">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" SharedSizeGroup="SplitterSizeGroup"/>
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Column="0" 
                       Text="{Binding Title}" 
                       FontStyle="Italic"
					   HorizontalAlignment="Stretch" 
                       FontWeight="Bold" />

            <Controls:ContextMenuButton x:Name="AddButton" 
                            Grid.Column="2" 
                            VerticalAlignment="Top" 
                            HorizontalAlignment="Right" 
                            Margin="0,0,0,0"
                            Visibility="{Binding Commands, Converter={StaticResource EnumerableToVisibilityConverter}, FallbackValue=Hidden}"                            
                            Style="{StaticResource ContextAdderButtonMenuStyle}"
                            AutomationProperties.AutomationId ="{Binding Title}"
                            >
                <Controls:ContextMenuButton.ContextMenu>
                    <Controls:SelectionNotifyingContextMenu Placement="Right" ItemsSource="{Binding Commands}" Style="{StaticResource ContextMenuStyle}"  />
                </Controls:ContextMenuButton.ContextMenu>
            </Controls:ContextMenuButton>
        </Grid>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:SuggestedValuesBindableProperty}">
        <Grid HorizontalAlignment="Stretch">
            <Border BorderBrush="Red"
						BorderThickness="1"
						Margin="-1"
						x:Name="ErrorAdorner"
						Visibility="Collapsed" />
            <ComboBox ItemsSource="{Binding BindableSuggestedValues}"
							  Text="{Binding BindableValue, ValidatesOnDataErrors=true}"
                              Validation.ErrorTemplate="{x:Null}"
							  x:Name="propertyDropdown"
                              Style="{StaticResource BindablePropertyStyle}"
							  Grid.Column="0"
							  IsEditable="true"
                              IsReadOnly="{Binding SuggestedValuesEditable, Converter={StaticResource BooleanInverseConverter}}"
                              IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanInverseConverter}}"
							  Visibility="Visible" 
                              AutomationProperties.Name="{Binding DisplayName}"/>
        </Grid>
        <DataTemplate.Triggers>
            <Trigger Property="Validation.HasError" Value="true" SourceName="propertyDropdown">
                <Setter Property="Visibility"
						Value="Visible"
						TargetName="ErrorAdorner" />
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:BindableProperty}">
        <Grid HorizontalAlignment="Stretch">
            <Border BorderBrush="Red"
						BorderThickness="1"
						Margin="-1"
						x:Name="ErrorAdorner"
						Visibility="Collapsed" />
            <TextBox
                        Validation.ErrorTemplate="{x:Null}" 		 
                        x:Name="valueTextBox"
                        Style="{StaticResource BindablePropertyStyle}"
                        IsReadOnly="{Binding ReadOnly}"
                        AutomationProperties.Name="{Binding DisplayName}"
                        Text="{Binding BindableValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=true}" />
        </Grid>
        <DataTemplate.Triggers>
            <Trigger Property="Validation.HasError" Value="true" SourceName="valueTextBox">
                <Setter Property="Visibility"
						Value="Visible"
						TargetName="ErrorAdorner" />
            </Trigger>
            <DataTrigger Binding="{Binding ReadOnly}" Value="true">
                <Setter TargetName="valueTextBox" Property="IsEnabled" Value="false" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:FrameworkEditorBindableProperty}">
        <ContentControl Content="{Binding Editor}" />
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:PopupEditorBindableProperty}">
        <DockPanel>
            <Button Content="..."
						DockPanel.Dock="Right"
						Width="15"
						Height="20"
						Command="{Binding LaunchEditor}"
						CommandParameter="{Binding}"
						x:Name="propertyPopupButton"
						HorizontalAlignment="Right"
                        VerticalAlignment="Top"
                        Focusable="true"
						IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanInverseConverter}}" />
            <Grid HorizontalAlignment="Stretch">
                <Border BorderBrush="Red"
							BorderThickness="1"
							Margin="-1"
							x:Name="ErrorAdorner"
							Visibility="Collapsed" />
                <TextBox IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanInverseConverter}}"
							Validation.ErrorTemplate="{x:Null}"
                            Style="{StaticResource BindablePropertyStyle}"
							x:Name="valueTextBox"
                            IsReadOnly="{Binding TextReadOnly}"
                            AutomationProperties.Name="{Binding DisplayName}"
                            Text="{Binding BindableValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=true}"
                         />
            </Grid>

        </DockPanel>
        <DataTemplate.Triggers>
            <Trigger Property="Validation.HasError"
					 Value="true"
					 SourceName="valueTextBox">
                <Setter Property="Visibility"
						Value="Visible"
						TargetName="ErrorAdorner" />
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate x:Key="ActualProperty">
        <Grid HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="50" Width="Auto" SharedSizeGroup="PropLabel" />
                <ColumnDefinition MinWidth="50" Width="175*" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Column="0"
					   Text="{Binding DisplayName}"
					   ToolTip="{Binding Description}"
					   Margin="5,0,5,0"
                       TextTrimming="CharacterEllipsis"
					   HorizontalAlignment="Left" 
                       VerticalAlignment="Top" />

            <ContentControl Focusable="False" Grid.Column="1" Content="{Binding BindableProperty}" />

        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Hidden}"
						 Value="True">
                <Setter Property="Visibility"
						Value="Collapsed" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>


    <DataTemplate DataType="{x:Type ViewModel:Property}"
				  x:Key="ChildPropertyTemplate">
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>

            <ContentControl Focusable="False" Grid.Column="1" Content="{Binding}" ContentTemplate="{StaticResource ActualProperty}" />

        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Hidden}"
						 Value="True">
                <Setter Property="Visibility"
						Value="Collapsed" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:Property}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="12" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ToggleButton Template="{DynamicResource ExpanderToggleButton}"
                          Visibility="{Binding HasChildProperties, Converter={StaticResource BooleanToVisibilityConverter}}"
                          x:Name="ShowChildProperties"
                          IsChecked="{Binding PropertiesShown}"
                          Height="6"
                          Width="12"
                          Margin="0, -6, 0, 0"
				          Background="{DynamicResource NormalBrush}"
				          OverridesDefaultStyle="True" 
						  VerticalAlignment="Center"
                          HorizontalAlignment="Center"
                          Grid.Column="0" >
            </ToggleButton>

            <ContentControl 
                          Focusable="False"
                          Grid.Column="1" 
                          Content="{Binding}" 
                          ContentTemplate="{StaticResource ActualProperty}" />

            <ItemsControl Focusable="False"
                          ItemsSource="{Binding ChildProperties}"
                          ItemTemplate="{StaticResource ActualProperty}"
					      Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=ShowChildProperties, Mode=TwoWay}"
					      Grid.Column="1"
					      Grid.Row="1" />

        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Hidden}"
						 Value="True">
                <Setter Property="Visibility"
						Value="Collapsed" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:SectionViewModel}">
        <Controls:SectionModelContainer DataContext="{Binding}">
            <Controls:SectionModelContainer.ContextMenu>
                <Controls:SelectionNotifyingContextMenu ItemsSource="{Binding Commands}" Style="{StaticResource ContextMenuStyle}" />
            </Controls:SectionModelContainer.ContextMenu>
        </Controls:SectionModelContainer>
    </DataTemplate>

    <Style x:Key="ButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#F3F3F3" Offset="0"/>
        <GradientStop Color="#EBEBEB" Offset="0.5"/>
        <GradientStop Color="#DDDDDD" Offset="0.5"/>
        <GradientStop Color="#CDCDCD" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>

    <Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <ContentControl Focusable="False" x:Name="DeleteButtonVisual" Foreground="{DynamicResource ElementCommandNormalBrush}" Background="{DynamicResource BackgroundBrush}">
                        <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="17" Height="17">
                            <Path Width="18" Height="18" Canvas.Left="-0.500002" Canvas.Top="-0.499999" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00949494" Fill="#00FFFFFF" Data="F1 M 3,9.53674e-007L 14,9.53674e-007C 15.6569,9.53674e-007 17,1.34315 17,3L 17,14C 17,15.6569 15.6569,17 14,17L 3,17C 1.34314,17 -1.7257e-006,15.6569 -1.7257e-006,14L -1.7257e-006,3C -1.7257e-006,1.34315 1.34314,9.53674e-007 3,9.53674e-007 Z "/>
                            <Path Width="18" Height="18" Canvas.Left="-0.500002" Canvas.Top="-0.499999" Stretch="Fill" StrokeLineJoin="Round" Stroke="{DynamicResource ElementCommandNormalBrush}" Data="F1 M 3,9.53674e-007L 14,9.53674e-007C 15.6569,9.53674e-007 17,1.34315 17,3L 17,14C 17,15.6569 15.6569,17 14,17L 3,17C 1.34314,17 -1.7257e-006,15.6569 -1.7257e-006,14L -1.7257e-006,3C -1.7257e-006,1.34315 1.34314,9.53674e-007 3,9.53674e-007 Z "/>

                            <Path Width="11.9834" Height="11.9834" Canvas.Left="2.50829" Canvas.Top="2.50828" Stretch="Fill" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource ElementCommandShadowBrush}" Data="F1 M 12.9917,4.00828L 4.00829,12.9917"/>
                            <Path Width="11.9834" Height="11.9834" Canvas.Left="2.5083" Canvas.Top="2.50828" Stretch="Fill" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource ElementCommandShadowBrush}" Data="F1 M 4.0083,4.00828L 12.9917,12.9917"/>

                            <Path Width="10.9834" Height="10.9834" Canvas.Left="3.00829" Canvas.Top="3.00828" Stretch="Fill" StrokeThickness="2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{Binding Foreground, ElementName=DeleteButtonVisual}" Data="F1 M 12.9917,4.00828L 4.00829,12.9917"/>
                            <Path Width="10.9834" Height="10.9834" Canvas.Left="3.0083" Canvas.Top="3.00828" Stretch="Fill" StrokeThickness="2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Stroke="{Binding Foreground, ElementName=DeleteButtonVisual}" Data="F1 M 4.0083,4.00828L 12.9917,12.9917"/>
                        </Canvas>
                    </ContentControl>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="#ADADAD"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver"  Value="true">
                            <Setter TargetName="DeleteButtonVisual" Property="Foreground" Value="{DynamicResource ElementCommandMouseOverBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CommandMenuItemStyle" TargetType="{x:Type MenuItem}">
        <Setter Property="IsEnabled" Value="{Binding ItemsSource, RelativeSource={RelativeSource Self}, Converter={StaticResource EnumerableToBooleanConverter}}" />
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type MenuItem}">
                    <Setter Property="AutomationProperties.AutomationId" Value="{Binding Title}" />
                </Style>
            </Setter.Value>
        </Setter>

        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Label Content="{Binding Title}" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>